/**
 * @作者 伟子涵
 * @微信公号 搬砖暗夜码农
 * @开源项目 $ https://gitee.com/zhouwei5208888
 * @我的博客 $ http://itzhouwei.com
 * @创建时间 2023/12/21  14:21
 */
package com.itzhouwei.minis.beans.factory.config;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author：zw，微信：yingshengzw
 * @date: 2023/12/21  14:21 
 * @Copyright： 公众号：搬砖暗夜码农 | 博客：https://itzhouwei.com - 沉淀、分享、成长，让自己和他人都能有所收获！
 */
@SuppressWarnings("all")
public class PropertyValues {


        private final List<PropertyValue> propertyValueList;
        public PropertyValues() {
            this.propertyValueList = new ArrayList<>(0);
        }
        public List<PropertyValue> getPropertyValueList() {
            return this.propertyValueList;
        }
        public int size() {
            return this.propertyValueList.size();
        }
        public void addPropertyValue(PropertyValue pv) {
            this.propertyValueList.add(pv);
        }

        public void removePropertyValue(PropertyValue pv) {
            this.propertyValueList.remove(pv);
        }
        public void removePropertyValue(String propertyName) {
            this.propertyValueList.remove(getPropertyValue(propertyName));
        }
        public PropertyValue[] getPropertyValues() {
            return this.propertyValueList.toArray(new PropertyValue[this.propertyValueList.size()]);
        }
        public PropertyValue getPropertyValue(String propertyName) {
            for (PropertyValue pv : this.propertyValueList) {
                if (pv.getName().equals(propertyName)) {
                    return pv;
                }
            }
            return null;
        }
        public Object get(String propertyName) {
            PropertyValue pv = getPropertyValue(propertyName);
            return pv != null ? pv.getValue() : null;
        }
        public boolean contains(String propertyName) {
            return getPropertyValue(propertyName) != null;
        }
        public boolean isEmpty() {
            return this.propertyValueList.isEmpty();
        }

}
